package com.zhuiyun.educations.api.courseprice.controller;

import com.zhuiyun.educations.api.courseprice.entity.Price;
import com.zhuiyun.educations.api.courseprice.service.CoursePriceService;
import com.zhuiyun.educations.common.response.CommonResult;
import com.zhuiyun.educations.util.pageUtil.PageRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName CoursePriceController
 * @Description TODO 课程价钱
 * @Author ys
 * @Date 2023/6/19 19:47
 **/
@Slf4j
@RestController
@Api(tags = "课程价钱")
@RequestMapping("/price")
public class CoursePriceController {
    @Resource
    private CoursePriceService coursePriceService;
    /**
     * @Author ys
     * @Description TODO 分页查询
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/getPrice")
    @ApiOperation(value = "课程价钱的分页查询方法")
    public CommonResult getPrice(PageRequest pageRequest,String courseTitle){
        log.info("分页查询");
        return coursePriceService.getPrice(pageRequest,courseTitle);
    }
    /**
     * @Author ys
     * @Description TODO 新增
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @PostMapping("/addPrice")
    @ApiOperation(value = "课程价钱的添加方法")
    public CommonResult addPrice(@RequestBody Price price) {
        log.info("添加");
        return coursePriceService.addPrice(price);
    }
    /**
     * @Author ys
     * @Description TODO 修改
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @PutMapping("/updatePriceById")
    @ApiOperation(value = "课程价钱的修改方法")
    public CommonResult updatePriceById(@RequestBody Price price) {
        log.info("修改");
        return coursePriceService.updatePrice(price);
    }
    /**
     * @Author ys
     * @Description TODO 逻辑删除
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @DeleteMapping("/deletePriceById")
    @ApiOperation(value = "课程价钱的逻辑删除方法")
    public CommonResult deletePriceById(int id) {
        log.info("逻辑删除");
        return coursePriceService.deletePriceById(id);
    }
    /**
     * @Author ys
     * @Description TODO 课程动态下拉
     * @Date 2023/6/26 14:09
     * @Return CommonResult
     * @param
     */
    @GetMapping("/courseSelect")
    @ApiOperation(value = "课程价钱的课程动态下拉方法")
    public CommonResult courseSelect(){
        log.info("课程动态下拉");
        return coursePriceService.courseSelect();
    }
}
